# iup
# Builds from https://github.com/puppylinux-woof-CE/petbuilds
# File auto generated by ./mk_petbuild.sh. Edit as necessary.

. ../func
. ../build.conf

URL=https://downloads.sourceforge.net/project/iup/3.21/Docs%20and%20Sources
PKG=iup
SVER=3.21_Sources
VER=3.21
COMP=zip
DESC="IUP is a portable toolkit for building graphical user interfaces"
DEPS=+pangox
CAT=BuildingBlock
DESKTOP=iup.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
# comment these 2 below if you use a custom package() function
#[ -f "$DESKTOP" ] || DESKTOP=not
#[ -z "$DEPS" ] && DEPS=not

ARCH=$(uname -m)
case $ARCH in # set in build.conf
 *64) 	LIBDIR=$LIBCONF64 
		FLAGS=$CF64;;
 arm*)	LIBDIR=$LIBCONFarm
		FLAGS="-O2" ;;
 i686) 	LIBDIR=$LIBCONF32 
		FLAGS=$CF32;;
	*) 	LIBDIR=$LIBCONF32 
		FLAGS="-O2 -march=$ARCH -mtune=$ARCH";;
esac

extract_() {
	unzip ${PKG}-${SVER}.${COMP} || exit 1
	mv -f ${PKG}-${SVER}.${COMP} ../0sources/
	mv ${PKG} ${PKG}-${VER}
}

build_() {
	(
	cd ${PKG}-${VER}
	make iupgtk USE_GTK2=Yes
	)
	mkdir -p ${PKG}-install/usr/{${LIBDIR},share/doc/${PKG},include/${PKG}}
	install -m644 ${PKG}-${VER}/lib/*/* ${PKG}-install/usr/${LIBDIR}
	install -m644 ${PKG}-${VER}/include/* ${PKG}-install/usr/include/${PKG}
	install -m644 ${PKG}-${VER}/COPYRIGHT ${PKG}-install/usr/share/doc/${PKG}
}

# main
retrieve ${PKG}-${SVER}.${COMP}
extract_
build_
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
